<%@ page import="java.util.List" %>
<%@ page import="java.sql.*" %>
<%@ page import="pfc.etsii.ull.es.*" %>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

    <iframe src="upload.html" name="SubHtml"
      width="500" height="170" scrolling="auto" frameborder="0">
      <p>Texto alternativo para navegadores que no aceptan iframes.</p>
    </iframe>
    
    <form action="PFC.html" method="get">
    <input type="hidden" name="gwt.codesvr" value="127.0.0.1:9997">
    <input type="hidden" name="cl" value="true">
    
	<select name="_ID_" id="ID_NIVEL"> 
    
    <%
    Connection conexion=null;

    String mensaje="";

    String driver = "com.mysql.jdbc.Driver";
    String url = "jdbc:mysql://193.145.147.13:3306/edevitalzh";
    String usuario = "cogvit";
    String clave = "edevitalzh";

    
    /*procedimiento de la conexion*/
    try{
        Class.forName(driver);
        conexion = DriverManager.getConnection(url,usuario,clave);
    } catch (Exception ex){
        mensaje=ex.toString();
    }
    System.out.println("Conectado");
    if(conexion.isClosed()){
    	System.out.println("DesConectado");
    }
    
	Statement s = null;
	ResultSet rs = null;
	
	try {
		s = (Statement) conexion.createStatement();
		rs = s.executeQuery ("select concat(name, surname), medicalrecord from patient");
		while (rs.next()) {
			String resultado = rs.getString(1); %>
			
			
			<option value="<%=rs.getString(2)%>"><%=rs.getString(1)%></option> 
			
			<%
			
			System.out.println(resultado);
		}
	} catch (SQLException e) {
		e.printStackTrace();
	} 

	
    %>
   
    </select>
   	<input type="submit" value="Enviar">
	</form>

</body>
</html>